﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using Modules.Library.Entities;

namespace Modules.Core {
    public class BasePersonControlViewModel : BaseViewModel {
        #region Variables
        public TextBox TxtAddress {get;set;}
        public TextBox TxtPersonId { get; set; }
        public TextBox TxtPersonFullName { get; set; }
        public TextBox TxtUserName { get; set; }
        public TextBox TxtDateOfBirth { get; set; }
        public TextBox TxtPhone { get; set; }
        public TextBox TxtEmail { get; set; }
        public TextBox TxtIdentifier { get; set; }
        public PasswordBox TxtPassword { get; set; }
        #endregion

        public BasePersonControlViewModel(TextBox txtFullName, TextBox txtPersonId, TextBox txtDateOfBirth, TextBox txtIdentifier, TextBox txtPhone, TextBox txtAddress,
            TextBox txtEmail, TextBox txtUserName, PasswordBox txtPassword) {
                this.TxtAddress = txtAddress;
                this.TxtPersonId = txtPersonId;
                this.TxtPersonFullName = txtFullName;
                this.TxtUserName = txtUserName;
                this.TxtDateOfBirth = txtDateOfBirth;
                this.TxtPhone = txtPhone;
                this.TxtEmail = txtEmail;
                this.TxtIdentifier = txtIdentifier;
                this.TxtPassword = txtPassword;
        }


        /// <summary>
        /// Thêm mới một khách hàng, nhân viên....
        /// </summary>
        public virtual void DoAddNewPerson() {

        }

        /// <summary>
        /// clear dữ liệu
        /// </summary>
        public override void DoClearFields() {
            //TxtAddress.Text = string.Empty;
            TxtPersonId.Text = string.Empty;
            TxtPersonFullName.Text = string.Empty;
            TxtUserName.Text = string.Empty;
            TxtDateOfBirth.Text = string.Empty;
            TxtPhone.Text = string.Empty;
            TxtEmail.Text = string.Empty;
            TxtIdentifier.Text = string.Empty;
            TxtPassword.Password = string.Empty;

        }

        //Kiểm tra cho nhân viên và khách hàng
        public override bool CheckIsNotNull() {
            return TxtAddress.Text != "" &&
            //TxtPersonId.Text != "" &&
            TxtPersonFullName.Text != "" &&
            TxtUserName.Text != "" &&
            TxtDateOfBirth.Text != "" &&
            TxtPhone.Text != "" &&
            TxtEmail.Text != "" &&
            TxtIdentifier.Text != "" &&
            TxtPassword.Password != "";
        }

    }
}
